import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)
const routes = [
  {
    path: '/',
    name: 'home',
    component: () => import('../views/Home/home.vue'),
    redirect: '/index',
    children: [
      { path: '/index', name: 'index', component: () => import('../views/Home/index.vue') },
    // 产品主页为动态路由
      { path: '/product/:id', name: 'product', component: () => import('../views/Home/product.vue') },
      { path: '/detail/:id', name: 'detail', component: () => import('../views/Home/detail.vue') }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login/login.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/Register/Register.vue')
  },
  {
    path: '/cart',
    name: 'cart',
    component: () => import('../views/Cart/cart.vue')
  },
  {
    path: '/order',
    name: 'order',
    component: () => import('../views/Order/order.vue'),
    redirect: '/list',
    children: [
      { path: 'list', name: 'order-list', component: () => import('../views/Order/orderList.vue') },
      { path: 'confirm', name: 'order-confirm', component: () => import('../views/Order/orderConfirm.vue') },
      { path: 'pay', name: 'order-pay', component: () => import('../views/Order/orderPay.vue') },
      { path: 'alipay', name: 'alipay', component: () => import('../views/Order/alipay.vue') }
    ]
  },
  
]
export default new Router({
  routes
})

